package controller;

import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.PageContext;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import entity.User;

@Controller
@RequestMapping("/application")
public class ServletContextController {
	
	//错
	@RequestMapping("/f1")
	public String f1(ServletContext application){
		User user=new User();
		user.setUsername("aaa");
		application.setAttribute("user", user);
		return "application";
	}
	
	//错
	@RequestMapping("/f2")
	public String f2(PageContext pageContext){
		ServletContext application=pageContext.getServletContext();
		User user=new User();
		user.setUsername("aaa");
		application.setAttribute("user", user);
		return "application";
	}
	
	//错
	@RequestMapping("/f3")
	public String f3(ServletConfig config){
		ServletContext application=config.getServletContext();
		User user=new User();
		user.setUsername("aaa");
		application.setAttribute("user", user);
		return "application";
	}
	
	@RequestMapping("/f4")
	public String f4(HttpSession session){
		ServletContext application=session.getServletContext();
		User user=new User();
		user.setUsername("aaa");
		application.setAttribute("user", user);
		return "application";
	}
	
	
	
	
	
	
}
